This page last changed on Jan 11, 2013 by headley.

Create a virtual disk and use it to make a bootable SD card

  • Shut down Linux guest VM
  • Open Linux guest VM settings > Hard Disk > Add Device... 
  • Set Disk Size
    • To use the entire target device (SD Card, USB stick), use same capacity as targeted device , e.g. 4.0 GB, 8.0 GB, 16.0 etc.
    • For testing, may use smaller capacity (will take up less host disk space and less time to transfer image to device)
  • Configure Advanced options
    • select IDE or SCSI (either OK)
    • select Pre-allocate disk space
    • de-select Split into 2 GB files
  • Click Apply
  • Choose name and path for virtual disk file
  • Restart the Linux guest VM

    The new disk icon should appear among the devices as a hard disk in the VM devices toolbar at the top of the VM window
    A device node will automatically created (e.g. /dev/sda) in the Linux VM, but will not be mounted automatically.
    It will have a name like /dev/sd<X>, where <X> is a,b, etc, but will not have any partitions listed (e.g. /dev/sda1).
    Use the mount command (no arguments) to determine which volumes are currently mounted; any current mounts are NOT the new virtual disk.
    Be careful not to partition or format the volume used by the Linux VM.

Partition and format virtual disk as SD card

Before installing files, the virtual disk must be partitioned and formatted. This may vary depending on what Linux distribution is being installed.
In this example, we'll create three partitions and format them as :

  • A FAT32 boot partition (beagleboot) that will contain the bootloaders (MLO and u-boot) and kernel image (uImage.bin)
  • An ext4 partition (beagleroot) to contain the linux root file system (rootfs)
  • An ext4 partition (beagledata) for application data

For this example, we'll assume a 2 GB virtual disk on /dev/sda. As root (or use sudo), do the following:

$ sudo fdisk /dev/sda

Print the partition table :

Command (m for help): p
 Disk /dev/sda: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9006ae65

   Device Boot      Start         End      Blocks   Id  System

If the disk size is correct and there is no partition table, proceed. Otherwise press 'q' to quit fdisk.

Create a 64 MB boot partition

  • 'n' - Create a new partition
  • 'p' - Type primary
  • '1' - Partition 1
  • <Enter> - Accept default start sector
  • '+64M' - Specify partition size
  • 't' - set partition type
  • '1' - Partition 1
  • 'c' - Type 'c' [WFAT32 LBA]

Now the partition table should include the new partition:

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      133119       65536    c  W95 FAT32 (LBA)

Create a 256 MB (or suitable size) rootfs partition

  • 'n' - Create a new partition
  • 'p' - Type primary
  • '2' - Partition 2
  • <Enter> - Accept default start sector
  • '+256M' - Specify partition size

Now if you print the partition table, it should look something like this:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      133119       65536    c  W95 FAT32 (LBA)
/dev/sda2          133120      657407      262144   83  Linux

Use the remainder of the disk for application data on a Linux partition

  • 'n' - Create a new partition
  • 'p' - Type primary
  • '3' - Partition 3
  • <Enter> - Accept default start sector
  • <Enter> - Accept default end sector

Now if you print the partition table, it should look something like this:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      133119       65536    c  W95 FAT32 (LBA)
/dev/sda2          133120      657407      262144   83  Linux
/dev/sda3          657408     4194303     1768448   83  Linux

To exit without modifying the partition table, press 'q', otherwise...

Note: the next step will (for practical purposes) delete all of the data on the disk.
Press 'w' to write the changes to the partition table and exit fdisk.

Use dd to write SD card
[mac]

  • Insert SD card in slot or card reader
  • Use diskutil as root to find device:
    $ diskutil list
    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *500.3 GB   disk0
       1:                        EFI                         209.7 MB   disk0s1
       2:                  Apple_HFS mbari1633               499.4 GB   disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
    /dev/disk1
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *1.0 TB     disk1
       1:                        EFI                         209.7 MB   disk1s1
       2:                  Apple_HFS SuperDuper              500.3 GB   disk1s2
       3:                  Apple_HFS TimeMachine             499.4 GB   disk1s3
    /dev/disk2
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:     FDisk_partition_scheme                        *2.0 GB     disk2
       1:                 DOS_FAT_16 NO NAME                 2.0 GB     disk2s1
  • Unmount the SD card volume:
    $ sudo diskutil unmountDisk /dev/disk2
    Password:
    Unmount of all volumes on disk2 was successful
  • Use dd to
    $ sudo dd if=sdcard-ide2G.img of=/dev/disk2

[linux]
The process to do this under Linux is very similar except that it's not required to un-mount the drive before using the 'dd' command and the commands are a little different. For example, you would use "fdisk -l" instead of "diskutil list", your device node would be located at "/dev/sda" instead of "/dev/disk" and the un-mount command is "umount" instead of "diskutil unmountDisk".

Document generated by Confluence on Feb 03, 2026 14:29